home *** CD-ROM | disk | FTP | other *** search
- This software is NOT freeware, and is distributed under the shareware
- concept, the fee requested for useage of this software is discussed
- at the end of this file (very reasonable).
- It is requested that this archive be distributed as a whole,
- and that all files herein be kept together.
- No fee should be charged for this software beyond actual distribution
- costs (connect fees, diskette costs), and should in no case exceed $10.
-
-
- What you should find in this archive:
-
- SPOOLER.DOC 12417 bytes This file.
- TP55SPL.TPU 14464 bytes Turbo Pascal 5.5 compatable unit.
- TP50SPL.TPU 15216 bytes Turbo Pascal 5.0 compatable unit.
- SPLTEST.PAS 1794 bytes Sample program using the spooler.
- SPLTEST.EXE 11152 bytes Executable version of same.
-
-
-
-
- SUMMARY:
- This unit implements a text file device driver (TFDD) called 'SPL'
- which is designed to allow Turbo Pascal 4.0-5.5 programs to dump
- text to the printer as is normally done using the 'LST' TFDD found
- in the 'printer' unit which is part of Turbo Pascal, but
- without arresting the operation of the program entirely until the
- printing is finished. It has been tested with Espon LX/MX/FX
- printers. By default it uses only a 16K main memory buffer, which
- should be fine for most text documents of 3 pages. If you try and
- dump more than that at a time you'll have to wait. Alternatively you
- can expand the main memory spooler buffer up to 65521 bytes. If you
- have Expanded memory on your computer you can install a spooler in
- EMS. It can be any size from 16K up to all of your EMS memory, at
- your discretion.
-
-
-
- As indicated above there are actually 3 modes in which the spooler can
- operate.
- 1) The default, put the spooler buffer in main memory on the Turbo
- Pascal heap. This spooler buffer can be any size between 16384 bytes
- and 65521 bytes (the largest single object that can be allocated on
- the TP heap).
- 2) If expanded memory is available, and a LIM 3.X compatable memory
- manager which supports data aliasing is loaded, then a spooler buffer
- between 16K and all the available expanded memory can be set up.
- 3) If expanded memory is not available, and regular memory is scarce,
- then the spooler can be directed to dump characters directly to the
- printer, as is normally done when writing to Turbo Pascal's LST
- printer device.
-
- It should be noted that first pausing the spooler's printing out and
- then overflowing the spooler buffer will likely lock up the system,
- so if you pause the spooler, don't feed it any more text.
-
- If a print screen is in progress then this spooler will wait until it's
- finished before accepting any characters to print. So DO NOT set
- the printscr bit or the system will lock up. Also printscr is disabled
- while the spooler has characters in it's buffer.
-
- This unit opens the printer in non-text file mode, this allows values of
- 26 to be sent to the printer. When the printer is opened with the
- normal text file driver, all 26's (End of File marker's in DOS) are
- automatically stripped off. If we are dumping graphics (for example)
- then this is obviously undesireable.
-
- This software does data aliasing in expanded memory, and therefore may
- not function with some types of software-only expanded memory emulators.
- (It should work on all 80386 specific expanded memory emulators.)
- This unit does however test for this capability and will simply
- refuse to install the spooler in EMS if this capability is not
- supported. No function specific to the LIM 4.0 specification are used
- so it should work with any LIM 3.X compatible memory manager.
-
-
-
- Sample useage:
-
- Writeln(SPL,'This is a test string.');
- Writeln(SPL,'This is a combo of variables',Variable,' and strings.');
- Writeln(SPL,#10#10,'This will give a couple of extra linefeeds.');
-
- ----------------------------------------------------------------------------
-
- The externally visible procedures comprising this unit are:
-
- 'SETPRINTER' - Allows you to change which printer the spooler will
- send characters to, the default is LPT1. To change to LPT2:
-
- SetPrinter(2);
-
-
- 'ALTERSPOOLERSIZE' - Allows you to change the default 16k spooler size.
- This function has no effect unless the spooler device is closed. To
- change the spooler size to 32k:
-
- Close(SPL); (* close spooler *)
- AlterSpoolerSize(32768); (* increase spooler size *)
- Rewrite(SPL); (* reopen spooler *)
-
-
- 'SPOOLFUNCS' - Allows the program to directly manupulate the workings
- of the spooler. It accepts an integer corresponding to the desired
- function.
- 1: Clear the spooler. This clears the contents of the spooling
- queue, and stops the printing.
- 2: Pause the spooler. This clauses the spooler to stop printing until
- the 'Resume' function (function 3) is used. This may be useful if
- you are doing something that is time critical and/or should not be
- interrupted until finished. This has no effect if the spooling
- is disabled (ie., printing directly to the printer).
- 3: Resume printing. This cancels the pause caused by function 2.
-
- 'SPOOLERSTATUS' - Allows the program to query the status of the spooler.
- Using the 'SplStatType' declared in this unit's interface section,
- the current size of the spooler can be determined ( a size of 0
- indicating either that the spooler is closed, or that the spooler
- is operating in the direct to printer mode (see description of
- operational modes and how to change them below). The number of bytes
- left in the spooler buffer to print can be ascertained. Finally whether
- the spooler is currently paused or not can be determined.
-
-
-
- The following three procedures/functions change the operating mode of
- the spooler. The spooler device which is by default open, must be closed
- for any of the following to have any effect.
-
- 'DIRECT_TO_PRINTER' - Changes the mode in which the spooler will be opened
- from the current mode, to direct to printer output. This Procedure
- will have no effect if the spooler device is not closed.
- EXAMPLE : If for some reason you don't want the spooler taking up main
- memory, ie., you need every byte of heap space you can get your hands
- on. You can close the spooler down, change the spooler to direct to
- printer operation, and reopen it:
-
- Close(SPL);
- Direct_To_Printer;
- Rewrite(SPL);
-
- This will deallocate the spooler buffer, and cause any characters
- sent to the spooler to go straight to the printer instead of into the
- spooler buffer. ie., calling:
-
- Writeln(SPL,' ..... ');
-
- will have the same effect as:
-
- Writeln(LST,' ..... ');
-
-
- 'SPOOL_IN_EMS' - Changes the mode in which the spooler will be opened
- from the current mode to spooling in expanded memory. It also specifies
- the size of the expanded memory buffer desired. This function checks
- to see if there is an expanded memory manager loaded, if that EMM
- supports data aliasing, and if enough expanded memory exists to support
- the request. If these conditions are met, then 0 is returned, otherwise
- a value of 1 is returned, and the previously assigned spooler mode
- remains operational. The EMS useage in this program saves and restores
- the condition of the expanded memory manager before and after use, so it
- should be compatable with programs that use EMS for other purposes.
- This function will fail if the spooler device is not closed.
- NOTE: Spooler size is rounded up to the next largest 16K block size.
- EXAMPLE: I want to allocate a 32K spooler buffer in EMS:
-
- Close(SPL);
- IF Spool_In_EMS(32768) = 0 THEN
- Rewrite(SPL);
-
-
- 'SPOOL_IN_MEMORY' - Changes the mode in which the spooler will be opened
- from the current mode to spooling in main memory. As indicated above
- this procedure will have no effect if the spooler device is not closed.
-
-
-
-
- There are a number of cases where the calling one of the associated
- spooler functions (Rewrite,Writeln,Write) can cause an error condition.
- If you compile with I/O error checking off you'll be able to catch
- these and prevent program termination.
- Possible return codes which can occur are:
-
- Writeln,Write :
- 160 : Out of paper, Device write fault.
-
- Rewrite:
- 1 : Failure allocating EMS spooler.
- ( Only if you try to allocate the EMS spooler. )
- 203 : If the spooler cannot allocate memory for it's buffer.
- ( Heap either too small or fragmented, main memory spooler. )
-
-
-
-
-
- The following is the interface for the spooler unit.
- To compile this unit for Turbo Pascal 4.0 you will have to remove some
- of the compiler directives which do not exist in TP 4.0.
-
- {$A+,R-,S+,I+,D+,F-,V-,B-,N-,E-,L+,O-}
-
- {--------------------------------------------------------------------}
- {---------------------------} INTERFACE {----------------------------}
- {--------------------------------------------------------------------}
-
- uses CRT,DOS;
-
- CONST
- SplClear = 1; { Clear the spooler. }
- SplPause = 2; { Pause the spooler's printing. }
- SplResume = 3; { Resume spooler printing. }
-
- TYPE
- SplStatType = RECORD { Used in calls to 'SpoolerStatus'. }
- SplSize : Longint;
- BytesToPrint : Longint;
- Paused : BOOLEAN;
- END;
-
-
- VAR
- SPL : TEXT; { New text file. }
-
- Procedure SpoolFuncs(Operation : Integer);
- Procedure SpoolerStatus(VAR Spoolstat : SplStatType);
- Procedure SetPrinter(Port : BYTE); { Change the printer spl sends to. }
- Procedure AlterSpoolerSize(Size : LongInt);
-
- Procedure Direct_To_Printer; { Select Mode of Spooler. }
- Function Spool_In_EMS(Size : LongInt):Integer;
- Procedure Spool_In_Memory;
-
-
- { END of interface }
-
-
-
-
- MORAL DOGMA
- ___________
-
- If you like this programming unit and find it useful, you are requested
- to support it's continued development, and the development of other
- useful programming tools for serious pascal developers by sending $10
- to the address below. In addition to peace of mind, for your $10 you'll
- get the right to use this unit in your programs royalty free. Please
- send postal money orders or a check drawn on a Canadian bank. (Sending
- cash in the mail is a bad practice.)
-
- Whether you decide to pony up this minor utilization fee or not, the
- author would appreciate any bug reports or suggestions that may
- be forthcoming.
-
-
- Douglas Webb
- 228 Murray St.
- Montreal, Quebec
- H3C 2C7
- CANADA
-
-
- LEGAL DOGMA
- ___________
-
-
- Douglas Webb (hereafter refered to as 'the author') hereby disclaims all
- warranties relating to this software, whether express or implied,
- including without limitation any implied warranties of merchantability
- or fitness for a particular purpose. The author will not be liable
- for any special, incidental, consequential, indirect or similar damages
- due to loss of data or any other reason, even if the author has been
- advised of the possibility of such damages. The person using the software
- bears all risk as to the quality and performance of the software.
-
- The author has done his very best to make sure that everything stated
- above is correct. However, the author assumes no responsibility for errors
- that may appear in the descriptions of this software (although he would
- like to hear about them).
-
-
-
- Turbo Pascal is a trademark of Borland International.
-
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 2,000+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705
- Houston, TX 77235-5705
- (713) 524-6394
-